import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

ApplicationWindow {
    visible: true
    width: 800
    height: 600
    title: "粒子系统示例"

    Rectangle {
        anchors.fill: parent
        color: "#2c3e50"

        RowLayout {
            anchors.fill: parent
            spacing: 0

            ListView {
                id: demoList
                width: 180
                Layout.fillHeight: true
                model: ListModel {
                    ListElement { name: "大小随机性"; source: "ParticleSizeVariation.qml" }
                    ListElement { name: "生命周期随机性"; source: "ParticleLifespanVariation.qml" }
                    ListElement { name: "颜色随机性"; source: "ParticleColorVariation.qml" }
                    ListElement { name: "位置随机性"; source: "ParticlePositionVariation.qml" }
                    ListElement { name: "角度随机性"; source: "ParticleAngleVariation.qml" }
                    ListElement { name: "速度随机性"; source: "ParticleVelocityVariation.qml" }
                }
                delegate: Rectangle {
                    width: parent.width
                    height: 60
                    color: ListView.isCurrentItem ? "#2980b9" : "#34495e"

                    Text {
                        anchors.centerIn: parent
                        text: name
                        color: "white"
                        font.pixelSize: 16
                    }
                    MouseArea {
                        anchors.fill: parent
                        onClicked: demoList.currentIndex = index
                    }
                }
            }

            Loader {
                id: demoLoader
                Layout.fillWidth: true
                Layout.fillHeight: true
                source: demoList.model.get(demoList.currentIndex).source
            }
        }
    }
}
